ObservationalNetworks Module

History

current version 1.5 - 22nd July 2024

version date comment
1.0 03/Jun/2011 Original code
1.1 25/Nov/2016 added WriteDataFileUnit routine
1.2 02/Feb/2023 added AssignDataFromGrid
1.3 18/Feb/2023 optional scaleFactor in AssignDataFromGrid
1.4 07/Jun/2024 changed # with DateTime in output file header
1.5 22/Jul/2024 updated the synchronization of time of data to read

License

license: GNU GPL http://www.gnu.org/licenses/

Module Description

set of fortran routines to manage a group of stations (surface meteorological or other stations) spread over a given area for making regular observations.

defintion of Observation type definition of ObservationalNetwork type



Interfaces

public interface AssignDataFromGrid

  • private subroutine AssignDataFromGridReal(grid, network, scaleFactor)

    assign data to a network from grid_real

    Arguments

    Type IntentOptional Attributes Name
    type(grid_real), intent(in) :: grid
    type(ObservationalNetwork), intent(inout) :: network
    real(kind=float), intent(in), optional :: scaleFactor

public interface ReadData

  • private subroutine ReadDataFileUnit(network, fileunit, time, aggr_time, aggr_type, tresh)

    read data from file unit. Data spanned on multiple time steps can be aggregated computing average, cumulated, maximum or minimum. Aggregated value is considered as missing if number of actual available observations is less than a given percentage (tresh)

    Arguments

    Type IntentOptional Attributes Name
    type(ObservationalNetwork), intent(inout) :: network
    integer(kind=short), intent(in) :: fileunit
    type(DateTime), intent(in), optional :: time
    integer(kind=short), intent(in), optional :: aggr_time
    character(len=*), intent(in), optional :: aggr_type
    real(kind=float), intent(in), optional :: tresh

public interface ReadMetadata

  • private subroutine ReadMetadataFileName(filename, network)

    read metadata section from file

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: filename
    type(ObservationalNetwork), intent(out) :: network
  • private subroutine ReadMetadataFileUnit(fileunit, network)

    read metadata section from open unit

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=short), intent(in) :: fileunit
    type(ObservationalNetwork), intent(out) :: network

public interface WriteData

  • private subroutine WriteDataFileUnit(network, fileunit, init)

    write data from file unit. if optional argument init is true a string to initialize data section of file is written

    Arguments

    Type IntentOptional Attributes Name
    type(ObservationalNetwork), intent(in) :: network
    integer(kind=short), intent(in) :: fileunit
    logical, intent(in), optional :: init

public interface WriteMetadata

  • private subroutine WriteMetadataFileName(network, filename)

    write metadata section to file TODO: full CRS support

    Arguments

    Type IntentOptional Attributes Name
    type(ObservationalNetwork), intent(in) :: network
    character(len=*), intent(in) :: filename
  • private subroutine WriteMetadataFileUnit(network, fileunit)

    write metadata section to open file unit TODO: full CRS support

    Arguments

    Type IntentOptional Attributes Name
    type(ObservationalNetwork), intent(in) :: network
    integer(kind=short), intent(in) :: fileunit

Derived Types

type, public ::  Observation

Components

Type Visibility Attributes Name Initial
character(len=20), public :: id

identification code

character(len=300), public :: name

name of observational site

real(kind=float), public :: value

The observation value itself

type(Coordinate), public :: xyz

easting, northing and elevation in real world

real(kind=float), public :: z

elevation [m] a.s.l.

type, public ::  ObservationalNetwork

Components

Type Visibility Attributes Name Initial
integer(kind=short), public :: countObs

number of observations in network

integer(kind=short), public :: dataType

1 = continuous, 2 = cumulative, 3 = incremental, 4 = average, 5 = maximum, 6 = minimum

character(len=300), public :: description

The name of the physical, chemical, or biological quantity that the value represents (e.g. streamflow, precipitation, water quality)

integer(kind=short), public :: epsg
type(CRS), public :: mapping
real(kind=float), public :: nodata

conventional code for missing data

type(Observation), public, ALLOCATABLE :: obs(:)

arbitrary observations in network

real(kind=float), public :: offsetZ

offset from ground elevation [m]

character(len=300), public :: path

filesystem path of file containing observations

logical, public :: syncData = .FALSE.

true when network is synchronized to data section in file

type(DateTime), public :: time

The date and time of the observations

integer(kind=short), public :: timeIncrement
character(len=100), public :: unit

unit of measure


Subroutines

public subroutine ActualObservations(network, count, activeNetwork)

count number of observations different from missing data Can optionally return network containing actual measurements.

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: network
integer(kind=short), intent(out) :: count
type(ObservationalNetwork), intent(out), optional :: activeNetwork

public subroutine CopyNetwork(input, output)

make a copy of one observational network

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: input
type(ObservationalNetwork), intent(inout) :: output

public subroutine DestroyNetwork(network)

deallocate space

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(inout) :: network

private subroutine AssignDataFromGridReal(grid, network, scaleFactor)

assign data to a network from grid_real

Arguments

Type IntentOptional Attributes Name
type(grid_real), intent(in) :: grid
type(ObservationalNetwork), intent(inout) :: network
real(kind=float), intent(in), optional :: scaleFactor

private subroutine ReadDataFileUnit(network, fileunit, time, aggr_time, aggr_type, tresh)

read data from file unit. Data spanned on multiple time steps can be aggregated computing average, cumulated, maximum or minimum. Aggregated value is considered as missing if number of actual available observations is less than a given percentage (tresh)

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(inout) :: network
integer(kind=short), intent(in) :: fileunit
type(DateTime), intent(in), optional :: time
integer(kind=short), intent(in), optional :: aggr_time
character(len=*), intent(in), optional :: aggr_type
real(kind=float), intent(in), optional :: tresh

private subroutine ReadMetadataFileName(filename, network)

read metadata section from file

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
type(ObservationalNetwork), intent(out) :: network

private subroutine ReadMetadataFileUnit(fileunit, network)

read metadata section from open unit

Arguments

Type IntentOptional Attributes Name
integer(kind=short), intent(in) :: fileunit
type(ObservationalNetwork), intent(out) :: network

private subroutine WriteDataFileUnit(network, fileunit, init)

write data from file unit. if optional argument init is true a string to initialize data section of file is written

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: network
integer(kind=short), intent(in) :: fileunit
logical, intent(in), optional :: init

private subroutine WriteMetadataFileName(network, filename)

write metadata section to file TODO: full CRS support

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: network
character(len=*), intent(in) :: filename

private subroutine WriteMetadataFileUnit(network, fileunit)

write metadata section to open file unit TODO: full CRS support

Arguments

Type IntentOptional Attributes Name
type(ObservationalNetwork), intent(in) :: network
integer(kind=short), intent(in) :: fileunit